{#include main fluid=true}
  {#title}Scheduled Methods{/title}
  {#style}
   span.app-class {
     cursor:pointer;
     color:blue;
     text-decoration:underline;
   }

   .formInputButton:hover {
     color: #3366ac !important;
     cursor: pointer;
   }

   #filterInputGroup {
     padding-bottom: 10px;
   }
  {/style}
  {#script}
    $(document).ready(function(){
      $("#filterInput").on("keyup", function() {
        var value = $(this).val().toLowerCase();
        $(".schedulerTable tr").filter(function() {
          $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
        });
      });

      if (!ideKnown()) {
        return;
      }
      $(".class-candidate").each(function() {
        var className = $(this).text();
        if (appClassLocation(className)) {
          $(this).addClass("app-class");
        }
      });

      $(".app-class").on("click", function() {
        openInIDE($(this).text());
      });
    });

    function clearFilterInput(){
      $("#filterInput").val("");
      $(".schedulerTable tr").filter(function() {
        if(!$(this).is(":visible")){
          $(this).toggle(true)
        }
      });
    }

  {/script}
  {#body}
  {#if info:scheduler.running}
  <form method="post" enctype="application/x-www-form-urlencoded">
    <strong>Scheduler is running</strong> 
    <input type="hidden" name="action" value="pause">
    <button type="submit" class="btn btn-primary" type="submit"><i class="far fa-pause-circle"></i> Pause</button>
  </form>
  {#else}
  <form method="post" enctype="application/x-www-form-urlencoded">
     <strong>Scheduler is paused</strong>
     <input type="hidden" name="action" value="resume">
     <button type="submit" class="btn btn-primary" type="submit"><i class="far fa-play-circle"></i> Resume</button>
  </form>
  {/if}
  <hr/>
  <div id="filterInputGroup" class="input-group application-properties-form">
    <input id="filterInput" type="text" class="form-control" aria-describedby="filterInputPrepend" placeholder="Search...">
    <div class="input-group-append">
      <span class="input-group-text formInputButton" onclick="clearFilterInput();"><i class="fas fa-times"></i></span>
    </div>
  </div>

  <table class="table table-striped">
   <thead class="thead-dark">
    <tr>
      <th scope="col">#</th>
      <th scope="col">Schedule</th>
      <th scope="col">Source</th>
      <th scope="col">Actions</th>
    </tr>
   </thead>
   <tbody class="schedulerTable">
   {#for scheduledMethod in info:schedulerContext.scheduledMethods}
    <tr>
      <td>{scheduledMethod_count}.</td>
      <td>
       {#if scheduledMethod.schedules.size > 1}
         <ol type="a">
         {#for schedule in scheduledMethod.schedules}
           <li>{#scheduleInfo schedule /}</li>
         {/for}
         </ol>
       {#else}
         {#scheduleInfo scheduledMethod.schedules.iterator.next /}
       {/if}
      </td>
      <td>
        <span class="class-candidate">{scheduledMethod.declaringClassName}</span>#{scheduledMethod.methodName}()
      </td>
      <td>
       <form method="post"  enctype="application/x-www-form-urlencoded">
        <input type="hidden" name="name" value="{scheduledMethod.methodDescription}">
        <input id="invoke" type="submit" value="Invoke" class="btn btn-primary btn-sm">
       </form>
      </td>
    {/for}
   </tbody>
  </table>
  {/body}
{/include}